<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      >



    <ui:composition template="./WEB-INF/includes-templates/template.xhtml">
        <ui:param name="pageTitle" value="#{trans.system_name}" />
        <ui:define name="content" >
            <ui:include src="/WEB-INF/includes/searchBar.xhtml" />
            <h3>#{trans.b_schoolMat}</h3>
            <br />
            <br />
            <br />

            <p:commandButton id="modalDialogButton" value="#{trans.b_uploadMaterial}" onclick="dlgm.show();" type="button"/>  
            <br />
            <br />
            <h:form>  
                <p:dataTable var ="pick" value="#{year.list}">  
                    <p:column headerText="#{trans.year}">  
                        <p:commandLink value="#{pick.toString()}" action="#{year.pickYear(pick)}"  ajax="false">
                            <f:setPropertyActionListener target="#{schoolmat.selectedSchoolMat}" value="#{schoolmat.schoolMatsByYear(pick)}" />
                        </p:commandLink>   

                    </p:column>  

                </p:dataTable>  
            </h:form> 

            <p:dialog id="modalDialogUpload" header="#{trans.b_uploadMaterial}" widgetVar="dlgm" 
                       height="300" width="660" showEffect="fade" hideEffect="clip" 
                         >  
               
                <h:form enctype="multipart/form-data">  

                     
                    
                    <p:panelGrid columns="2" >
                        <h:outputLabel value="#{trans.year}" />
                        <h:inputText value="" />
                        
                        <h:outputLabel value="#{trans.subject}" />
                        <h:inputText value="" />
                        
                    </p:panelGrid>
                    <br />
                    
                    <p:fileUpload fileUploadListener="#{fileUploadController.handleFileUpload}"  
                                  mode="advanced"   
                                  update=":mes"  

                                  allowTypes="/(\.|\/)(ppt?x|doc?x|pdf)$/"/> 

                </h:form>  
                <p:messages id="mes"/>

            </p:dialog>

        </ui:define>


    </ui:composition>


</html>
